import React, { useEffect } from 'react';
import { Tabs } from 'antd';
import { Link, history } from 'umi';
import { PageContainer } from '@ant-design/pro-layout';

const { TabPane } = Tabs;

const Index = props => {
    const { children } = props
    console.log(props);

    useEffect(() => {
        history.push('/module_b/child1')
    }, [])

    return (
        <PageContainer
            content={
                <span><Link to="/module_a/child">点击跳转 - /module_a/child</Link></span>
            }
        >
            <div>
                <p>Module B</p>
                <Tabs defaultActiveKey="1" onChange={(k) => {
                    history.push('/module_b/' + k)
                }}>
                    <TabPane tab="Tab 1" key="child1" />
                    <TabPane tab="Tab 2" key="child2" />
                </Tabs>
                {children}
            </div>
        </PageContainer>
    )
}

export default Index